import java.util.*;

public class PaperSelection {
    private final Map<Student, List<Paper>> selections = new HashMap<>();

    public synchronized void select(Student student, List<Paper> papers) {
        if (!selections.containsKey(student)) {
            selections.put(student, papers);
        }
    }

    public synchronized boolean hasSelected(Student student) {
        return selections.containsKey(student);
    }

    public synchronized String toString() {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<Student, List<Paper>> entry : selections.entrySet()) {
            sb.append(entry.getKey().getName()).append(" selected: ");
            for (Paper p : entry.getValue()) {
                sb.append("[").append(p.toString()).append("] ");
            }
            sb.append("\n");
        }
        return sb.toString();
    }
}
